package com.qiezi.project.adapter;

import android.net.Uri;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.facebook.drawee.view.SimpleDraweeView;
import com.qiezi.R;
import com.qiezi.base.BaseRecyclerAdapter;
import com.qiezi.bean.VideoBean;

public class RecommendAdapter extends BaseRecyclerAdapter<VideoBean> {



    public class VH extends Holder{

        SimpleDraweeView iv;
        TextView tvTitle,tvTime;

        public VH(View itemView) {
            super(itemView);
            iv = itemView.findViewById(R.id.iv_urlPlayImage);
            tvTitle = itemView.findViewById(R.id.tv_urlPlayTitle);
            tvTime = itemView.findViewById(R.id.tv_urlPlayTime);
        }

        public void setData(VideoBean data){
            Uri uri = Uri.parse(data.getImage());
            iv.setImageURI(uri);
            tvTitle.setText(data.getName());
            tvTime.setText(data.getUpdatetime());
        }
    }


    @Override
    public RecyclerView.ViewHolder onCreate(ViewGroup parent, int viewType) {
        View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_url_play, parent, false);
        return new VH(v);
    }

    @Override
    public void onBind(RecyclerView.ViewHolder viewHolder, int RealPosition, VideoBean data) {
        ((VH)viewHolder).setData(data);
    }

}
